package com.aerotechnic.service.implementation;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.aerotechnic.dao.implementation.GenericDao;
import com.aerotechnic.dao.implementation.UserDao;
import com.aerotechnic.dao.interfaces.UserDaoIn;
import com.aerotechnic.entities.User;
import com.aerotechnic.service.interfaces.UserBoIn;

@Service("UserBo")
@Transactional
public class UserBo implements UserBoIn{

	@Autowired
	private UserDaoIn userDao;

	@Override
	public void save(User myEntity) {
		userDao.save(myEntity);
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(User myEntity) {
		// TODO Auto-generated method stub
		userDao.update(myEntity);
		
	}

	@Override
	public void delete(int id) {
		// TODO Auto-generated method stub
		userDao.delete(id);
	}

	@Override
	public User findByID(int id) {
		// TODO Auto-generated method stub
		return userDao.findByID(id);
	}

	@Override
	public List<User> findAll() {
		// TODO Auto-generated method stub
		return userDao.findAll();
	}

//	@Transactional
	public User authenticate(String login, String password) {
		return userDao.authenticate(login, password);
	}

	@Override
	public int countAllUsers() {
		// TODO Auto-generated method stub
		return userDao.countAllUsers();
	}

	@Override
	public List<User> find(int startIndex, int pageSize) {
		// TODO Auto-generated method stub
		return userDao.find(startIndex, pageSize);
	}

}
